package IT.DataAccess;

/*import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;*/
//import java.util.Properties;
//import javax.sql.DataSource;
//import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.dbcp.BasicDataSource;
//import org.apache.commons.dbcp.BasicDataSourceFactory;

public class BDConexion {
    
    //private DataSource dataSource;
    private BasicDataSource basicDataSource;
    
    public BDConexion(){
   
    }
    
    public BasicDataSource getDataSource(){
        //Properties propiedades = new Properties();
        basicDataSource = new BasicDataSource();
        try {
            /*propiedades.load(new FileInputStream(
                    "src/Conexion.properties"));
            
            dataSource = BasicDataSourceFactory.createDataSource(propiedades);*/
           
            basicDataSource.setDriverClassName("com.mysql.jdbc.Driver");
            basicDataSource.setUsername("root");
            basicDataSource.setPassword("admin");
            basicDataSource.setUrl("jdbc:mysql://localhost:3306/inmedia");

            // Opcional. Sentencia SQL que le puede servir a BasicDataSource
            // para comprobar que la conexion es correcta.
            basicDataSource.setValidationQuery("select 1");
            
           
        } catch (Exception e) {
            e.printStackTrace();
        }
        return basicDataSource;
    }  
    
}
